import 'package:flutter/material.dart';
import 'package:flutter_shop/pages/home/tab_search/dataList.dart';
import 'package:flutter_shop/widgets/common.tag.dart';

class RoomListItemWidget extends StatelessWidget {
  final RoomListItemData data;

  const RoomListItemWidget(this.data, {Key key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 10),
      child: Row(
        children: [
          Image.asset(
            data.imageUrl,
            width: 110,
            height: 100,
            fit: BoxFit.cover,
          ),
          Padding(padding: EdgeInsets.only(left: 10)),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              //只显示一行，超出显示省略号
              Text(
                data.title,
                maxLines: 1,
                overflow: TextOverflow.ellipsis,
                style: TextStyle(fontWeight: FontWeight.bold),
              ),
              Text(data.subTitle),
              Wrap(
                children: data.tags.map((item) => CommonTag(item)).toList(),
              ),
              Text(
                '${data.price} 元/月',
                style: TextStyle(
                    color: Colors.orange, fontWeight: FontWeight.bold),
              ),
            ],
          )
        ],
      ),
    );
  }
}
